Assigning Values to Undeclared JavaScript Variables in js.

Basically Variable declares with var prefix. If you assign values to variables that have not yet been declared, the variables will automatically be declared as global variables.


#These statements:

x=5;
carname="Volvo";will declare the variables x and carname as global variables (if they don't already exist).

JavaScript Arithmetic

As with algebra, you can do arithmetic operations with JavaScript variables:

y=x-5;
z=y+5;

 

 

Output:

10
55
55
55

The rule is: If you add a number and a string, the result will be a string.

Comparison and Logical operators are used to test for true or false.

 



All Tutorial => 12345678910111213





Write Comment